home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
news
/
suck-2.6
/
suck-2
/
suck-2.6.3
/
sample
/
get.news.innxmit
next >
Wrap
Text File
|
1996-03-29
|
3KB
|
99 lines
#!/bin/sh
# NOTE: this script probably needs to be run by root. Most systems will
# not allow normal users to run ctlinnd and innxmit.
#BEFORE USING - check to ensure all the paths defined below are correct!!
REMOTE_HOST=news.pixi.com
LOCAL_HOST=localhost
SPOOLDIR=/usr/spool/news # base directory for articles to be rposted
NEWSDIR=/usr/lib/news # base directory for news binaries
BINDIR=/home/boby/doNews # base directory for suck rpost and scripts
TMPDIR=${BINDIR} # location for suck.* files
DATADIR=${BINDIR} # location of sucknewsrc and killfile
MSGDIR=${BINDIR}/Msgs # where to put MultiFile articles when getting them
BATCHFILE=${TMPDIR}/batch # Name of batchfile to build for rnews or innxmit
SITE=pixi # name of site
OUTGOING=${SPOOLDIR}/out.going/${SITE} # location of the list of articles to upload
OUTGOINGNEW=${OUTGOING}.new # temporarily used during upload of articles
SCRIPT=${BINDIR}/put.news # my filter for rpost
OUTFILE=/tmp/tmp$$ # used by rpost as article after it is filtered
RPOST=${BINDIR}/rpost # my rpost
SUCK=${BINDIR}/suck # my suck
TESTHOST=${BINDIR}/testhost # my testhost
INNXMIT=${NEWSDIR}/bin/innxmit # location of INNXMIT
CTLINND=${NEWSDIR}/bin/ctlinnd # location of CTLINND
# is the local host up and running so we can post articles we download?
${TESTHOST} ${LOCAL_HOST} -s -e
LOCAL_RESULT=$?
# is the remote host up and running so we can download articles?
${TESTHOST} ${REMOTE_HOST} -s -e
REMOTE_RESULT=$?
if [ ${REMOTE_RESULT} -eq 0 -a ${LOCAL_RESULT} -eq 0 ]; then
# download articles
${SUCK} ${REMOTE_HOST} -bi ${BATCHFILE} -dt ${TMPDIR} -dm ${MSGDIR} -dd ${DATADIR}
SUCK_STATUS=$?
if [ ${SUCK_STATUS} -eq 0 ]; then
echo "Downloaded Articles"
mv ${DATADIR}/sucknewsrc ${DATADIR}/old.newsrc
mv ${TMPDIR}/suck.newrc ${DATADIR}/sucknewsrc
rm ${TMPDIR}/suck.*
if [ -f ${DATADIR}/suckothermsgs ]; then
rm ${DATADIR}/suckothermsgs
fi
fi
# now upload articles
if [ -s ${OUTGOING} ]; then
# this is needed by INND so that the outgoing file will be
# properly flushed and we have a new blank file to work with
# when we are done
# First mv the current one to a new file name
# Since innd already has the file open, it doesn't care
# about the rename.
# The flush will ensure that all articles to be posted have
# been written out, close off the old one (already renamed)
# and create a new one.
mv ${OUTGOING} ${OUTGOINGNEW}
${CTLINND} flush ${SITE}
echo "reloaded ctlinnd"
# outgoing articles to post
${RPOST} ${REMOTE_HOST} -b ${OUTGOINGNEW} -p ${SPOOLDIR} -f \$\$o=${OUTFILE} ${SCRIPT} \$\$i ${OUTFILE}
if [ $? -ne 0 ]; then
echo "Error remote posting"
exit -1;
else
echo "Remotely posted articles"
rm ${OUTFILE} ${OUTGOINGNEW}
fi
fi
echo "You can hang up the modem now"
if [ ${SUCK_STATUS} -eq 0 ]; then
# locally post articles
${INNXMIT} ${LOCAL_HOST} ${BATCHFILE}
if [ $? -eq 0 ]; then
echo "Posted Articles Locally"
rm -rf ${MSGDIR}
fi
fi
fi